package com.bsi.rd.framework.zuul.remote.hystrix;/*
 * Author: liusongs
 * Date: 2019/10/21 11:18
 * Content:
 */

import com.bsi.rd.framework.zuul.remote.LoginUserServiceRemote;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class LoginUserServiceRemoteImpl implements FallbackFactory<LoginUserServiceRemote> {

    private Logger logger = LoggerFactory.getLogger(LoginUserServiceRemoteImpl.class);

    private String user;

    @Override
    public LoginUserServiceRemote create(Throwable throwable) {
        return new LoginUserServiceRemote() {
            @Override
            public String getUser() {
                logger.warn("testRemote getInFormation failed! start fallback==>:{}");
                logger.error("testRemote getInFormation error", throwable);
                return user;
            }
        };
    }
}
